package com.jason.www.dao;

import com.jason.www.domain.Permissions;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface PermissionsMapper {
    @Delete({
        "delete from permissions",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into permissions (id, theurl, ",
        "description)",
        "values (#{id,jdbcType=BIGINT}, #{theurl,jdbcType=VARCHAR}, ",
        "#{description,jdbcType=VARCHAR})"
    })
    int insert(Permissions record);

    @InsertProvider(type=PermissionsSqlProvider.class, method="insertSelective")
    int insertSelective(Permissions record);

    @Select({
        "select",
        "id, theurl, description",
        "from permissions",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="theurl", property="theurl", jdbcType=JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR)
    })
    Permissions selectByPrimaryKey(Long id);

    @UpdateProvider(type=PermissionsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Permissions record);

    @Update({
        "update permissions",
        "set theurl = #{theurl,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Permissions record);
}